<?php 
include_once("{$_SERVER['DOCUMENT_ROOT']}/header.php");
$query = iconv('euc-kr','utf-8',$query);
//$display = iconv('euc-kr','utf-8',$display);
//$yearfrom = iconv('euc-kr','utf-8',$yearfrom);
//$yearto = iconv('euc-kr','utf-8',$yearto);
//$genre = iconv('euc-kr','utf-8',$genre);
if(!$start){$start=1;}

$apiKey="eacbe303751676ff96771d2ae828a02c";
$s = simplexml_load_file("http://openapi.naver.com/search?key=$apiKey&query=$query&display=$display&start=$start&target=movie&yearfrom=$yearfrom&yearto=$yearto&genre=$genre");
$list .="총갯수".$s->channel->total;
$count=count($s->channel->item);
for ($i = 0 ; $i < $count ; $i++){
	if($s->channel->item[$i]->image==""){$s->channel->item[$i]->image=SCRIPT_ROOT."/class/db/bbs/hotel/img/noimage.gif";}
	
	$list .=  "
	<table>
	<tr>
	<td>$i</td>
	<td><img src='".$s->channel->item[$i]->image."' width='100' height='80'></td>
	<td width='350' valign='top'> <div id='title_$i' >".$s->channel->item[$i]->title."(".$s->channel->item[$i]->subtitle.")</div>
	(".$s->channel->item[$i]->subtitle.")
	개봉일 : ".$s->channel->item[$i]->pubDate."
	감독 : ".$s->channel->item[$i]->director."
	출연진 : ".$s->channel->item[$i]->actor."
	</td>
	<td><input type='button' value='선택' onClick=\"insertMovieInfo('title_$i','img_$i');\">
	</td>
	 </tr>
	 </table>
	 <div id='img_$i' style=\"display:none;\">".$s->channel->item[$i]->image."</div>
	";


}




?>
<div style="width:500px; height:600px; overflow-y:auto;">
<br>

<?=$list;?>

</div>
